﻿using System;

namespace RedisRepository
{
    public class RedisDbHelper
    {
        public RedisDbHelper()
        {
            //创建链接
            var csredis = new CSRedis.CSRedisClient("127.0.0.1:6379,password=123,defaultDatabase=1,poolsize=50,ssl=false,writeBuffer=10240");

            //初始化 RedisHelper
            RedisHelper.Initialization(csredis);
            
        }

        public void SingleInsert(string key,string value)
        {
            //赋值
            RedisHelper.Set(key, value);//设置值。默认永不过期

        }

        public string GetSingleValue(string key)
        {
            return RedisHelper.Get<String>(key);
        }
    }
}
